package com.key.service.impl;

import com.key.common.vo.SOCDVO;
import com.key.mapper.SOCDMapper;
import com.key.service.SOCDService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author：朕
 * @Package：com.key.service.impl
 * @Project：ams_system
 * @name：SOCDServiceImpl
 * @Date：2023/2/24 8:22
 * @Filename：SOCDServiceImpl
 */
@Service
public class SOCDServiceImpl implements SOCDService {

    @Autowired
    private SOCDMapper socdMapper;

    /**
     * 公司部门汇总
     * @return
     */
    @Override
    public Map<String,Object> findSOCD() {
        List<SOCDVO> socdvos = socdMapper.findSOCD();
        List<SOCDVO> integers = socdMapper.sumSOCD();
        Map<String,Object> map = new HashMap<>();
        map.put("msg",socdvos);
        map.put("QuantityAndMoney",integers);
        System.out.println(socdvos);
        System.out.println(integers);
        return map;
    }

    /**
     * 显示资产分类的名称
     * @return
     */
    @Override
    public String[] findAssetTypeName() {
        String[] strings = socdMapper.findAssetTypeName();
        return  strings;
    }

    /**
     * 根据资产分类显示公司部门汇总
     * @param typeName
     * @return
     */
    @Override
    public Map<String,Object> findSOCDByTypeName(String typeName) {
        List<SOCDVO> socdvos = socdMapper.findSOCDByTypeName(typeName);
        List<SOCDVO> integers = socdMapper.sumSOCDByTypeName(typeName);
        Map<String,Object> map = new HashMap<>();
        map.put("msg",socdvos);
        map.put("QuantityAndMoney",integers);
        return map;

    }

    /**
     * 根据公司编码显示公司部门汇总
     * @param Id
     * @return
     */
    @Override
    public List<SOCDVO> findBySOCDById(Integer Id) {
        List<SOCDVO> socdvos = socdMapper.findBySOCDById(Id);
        return socdvos;
    }
}
